package com.douban.business;

import java.util.Map;

import org.apache.xerces.xni.parser.XMLInputSource;
import org.apache.xerces.xni.parser.XMLParserConfiguration;
import org.cyberneko.html.HTMLConfiguration;

import com.core.sax.ElementNode;

import sample.Minimal;
import junit.framework.TestCase;

public class DoubanRecsDefinitionHandlerTest extends TestCase {

	
	public void testInit() throws Exception{

		DoubanRecsTemplateHandler.getInstance().initialize();
		
		Map ret = DoubanRecsTemplateHandler.getInstance().getMap();
		
		for(int i=0;i<DoubanRecsTemplateHandler.REC_TYPES.length;i++){
			String recType = DoubanRecsTemplateHandler.REC_TYPES[i];
			ElementNode node = (ElementNode)ret.get(recType);
			while(node!=null){
				System.out.println(node.getNodeName()+" "+node.getAttributes()+" "+node.getTextContent());
				ElementNode tempnode = (ElementNode)node.getFirstChild();
				if(tempnode==null){
					tempnode = (ElementNode)node.getNextSibling();
				}
				if(tempnode==null){
					tempnode = (ElementNode)node.getParentNode().getNextSibling();
				}
				node = tempnode;
			}
		}
	}
}
